package com.explore.demo.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.explore.demo.pojo.Category;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.explore.demo.pojo.Recruitment;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author gaolainan
 * @since 2021-04-14
 */
public interface CategoryMapper extends BaseMapper<Category> {

    /**
     * 跟据职位的id返回对应的分类名称
     * @param recruitmentId
     * @return
     */
    @Select("select category_name from category where id in (select category_id from recruit_category where recruit_id = #{recruitmentId})")
    public List<String> getCategoryName(Integer recruitmentId);

    /**
     * 根据info拿到对应的分类的id
     * @param info
     * @return
     */
    @Select("select id from category where category_name = #{info}")
    public Integer getCategoryId(String info);
}
